package cn.yinyu.queue.module.ecg.service.queue;

import cn.yinyu.queue.framework.common.exception.ErrorCode;
import cn.yinyu.queue.framework.common.exception.enums.GlobalErrorCodeConstants;

import java.util.concurrent.Callable;

public class BedDoctorNextInstallPatientCallable implements Callable<ErrorCode> {

    QueueServiceTxFunctions queueService;
    private Long roomId;
    private String bedNo;

    public BedDoctorNextInstallPatientCallable(QueueServiceTxFunctions queueService, Long roomId, String bedNo)
    {
        super();
        this.roomId = roomId;
        this.bedNo = bedNo;
        this.queueService = queueService;
    }

    public ErrorCode call() throws Exception {
        ErrorCode ec = queueService.nextInstallPatient(roomId, bedNo);
        if (GlobalErrorCodeConstants.SUCCESS.equals(ec)) {
            queueService.hurryupOneBed(roomId, bedNo);
        }

        queueService.monitorInfo();
        return ec;
    }

}
